package com.aaa.demo04;

/**
 * @author ${崔灿}
 * @date 2022/10/31 17:55
 **/

public class Girl implements Runnable{
    private BankCark bankCark;
    public Girl(BankCark bankCark) {
        this.bankCark = bankCark;
    }
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            if (bankCark.getBalance()>1000){
                bankCark.setBalance(bankCark.getBalance()-1000);
                System.out.println(Thread.currentThread().getName()+"向卡中取出1000,卡中余额:"+bankCark.getBalance());
            }else {
                System.out.println("卡中余额不在");
                i--;
            }
        }
    }
}
